
user/_bcachetest:     file format elf64-littleriscv


Disassembly of section .text:

0000000000000000 <createfile>:
  exit(0);
}

void
createfile(char *file, int nblock)
{
   0:	bd010113          	addi	sp,sp,-1072
   4:	42113423          	sd	ra,1064(sp)
   8:	42813023          	sd	s0,1056(sp)
   c:	40913c23          	sd	s1,1048(sp)
  10:	41213823          	sd	s2,1040(sp)
  14:	41313423          	sd	s3,1032(sp)
  18:	41413023          	sd	s4,1024(sp)
  1c:	43010413          	addi	s0,sp,1072
  20:	8a2a                	mv	s4,a0
  22:	89ae                	mv	s3,a1
  int fd;
  char buf[BSIZE];
  int i;
  
  fd = open(file, O_CREATE | O_RDWR);
  24:	20200593          	li	a1,514
  28:	00000097          	auipc	ra,0x0
  2c:	77c080e7          	jalr	1916(ra) # 7a4 <open>
  if(fd < 0){
  30:	04054a63          	bltz	a0,84 <createfile+0x84>
  34:	892a                	mv	s2,a0
    printf("test0 create %s failed\n", file);
    exit(-1);
  }
  for(i = 0; i < nblock; i++) {
  36:	4481                	li	s1,0
  38:	03305263          	blez	s3,5c <createfile+0x5c>
    if(write(fd, buf, sizeof(buf)) != sizeof(buf)) {
  3c:	40000613          	li	a2,1024
  40:	bd040593          	addi	a1,s0,-1072
  44:	854a                	mv	a0,s2
  46:	00000097          	auipc	ra,0x0
  4a:	73e080e7          	jalr	1854(ra) # 784 <write>
  4e:	40000793          	li	a5,1024
  52:	04f51763          	bne	a0,a5,a0 <createfile+0xa0>
  for(i = 0; i < nblock; i++) {
  56:	2485                	addiw	s1,s1,1
  58:	fe9992e3          	bne	s3,s1,3c <createfile+0x3c>
      printf("write %s failed\n", file);
      exit(-1);
    }
  }
  close(fd);
  5c:	854a                	mv	a0,s2
  5e:	00000097          	auipc	ra,0x0
  62:	72e080e7          	jalr	1838(ra) # 78c <close>
}
  66:	42813083          	ld	ra,1064(sp)
  6a:	42013403          	ld	s0,1056(sp)
  6e:	41813483          	ld	s1,1048(sp)
  72:	41013903          	ld	s2,1040(sp)
  76:	40813983          	ld	s3,1032(sp)
  7a:	40013a03          	ld	s4,1024(sp)
  7e:	43010113          	addi	sp,sp,1072
  82:	8082                	ret
    printf("test0 create %s failed\n", file);
  84:	85d2                	mv	a1,s4
  86:	00001517          	auipc	a0,0x1
  8a:	c0a50513          	addi	a0,a0,-1014 # c90 <malloc+0xec>
  8e:	00001097          	auipc	ra,0x1
  92:	a56080e7          	jalr	-1450(ra) # ae4 <printf>
    exit(-1);
  96:	557d                	li	a0,-1
  98:	00000097          	auipc	ra,0x0
  9c:	6cc080e7          	jalr	1740(ra) # 764 <exit>
      printf("write %s failed\n", file);
  a0:	85d2                	mv	a1,s4
  a2:	00001517          	auipc	a0,0x1
  a6:	c0650513          	addi	a0,a0,-1018 # ca8 <malloc+0x104>
  aa:	00001097          	auipc	ra,0x1
  ae:	a3a080e7          	jalr	-1478(ra) # ae4 <printf>
      exit(-1);
  b2:	557d                	li	a0,-1
  b4:	00000097          	auipc	ra,0x0
  b8:	6b0080e7          	jalr	1712(ra) # 764 <exit>

00000000000000bc <readfile>:

void
readfile(char *file, int nbytes, int inc)
{
  bc:	bc010113          	addi	sp,sp,-1088
  c0:	42113c23          	sd	ra,1080(sp)
  c4:	42813823          	sd	s0,1072(sp)
  c8:	42913423          	sd	s1,1064(sp)
  cc:	43213023          	sd	s2,1056(sp)
  d0:	41313c23          	sd	s3,1048(sp)
  d4:	41413823          	sd	s4,1040(sp)
  d8:	41513423          	sd	s5,1032(sp)
  dc:	44010413          	addi	s0,sp,1088
  char buf[BSIZE];
  int fd;
  int i;

  if(inc > BSIZE) {
  e0:	40000793          	li	a5,1024
  e4:	06c7c463          	blt	a5,a2,14c <readfile+0x90>
  e8:	8aaa                	mv	s5,a0
  ea:	8a2e                	mv	s4,a1
  ec:	84b2                	mv	s1,a2
    printf("test0: inc too large\n");
    exit(-1);
  }
  if ((fd = open(file, O_RDONLY)) < 0) {
  ee:	4581                	li	a1,0
  f0:	00000097          	auipc	ra,0x0
  f4:	6b4080e7          	jalr	1716(ra) # 7a4 <open>
  f8:	89aa                	mv	s3,a0
  fa:	06054663          	bltz	a0,166 <readfile+0xaa>
    printf("test0 open %s failed\n", file);
    exit(-1);
  }
  for (i = 0; i < nbytes; i += inc) {
  fe:	4901                	li	s2,0
 100:	03405063          	blez	s4,120 <readfile+0x64>
    if(read(fd, buf, inc) != inc) {
 104:	8626                	mv	a2,s1
 106:	bc040593          	addi	a1,s0,-1088
 10a:	854e                	mv	a0,s3
 10c:	00000097          	auipc	ra,0x0
 110:	670080e7          	jalr	1648(ra) # 77c <read>
 114:	06951763          	bne	a0,s1,182 <readfile+0xc6>
  for (i = 0; i < nbytes; i += inc) {
 118:	0124893b          	addw	s2,s1,s2
 11c:	ff4944e3          	blt	s2,s4,104 <readfile+0x48>
      printf("read %s failed for block %d (%d)\n", file, i, nbytes);
      exit(-1);
    }
  }
  close(fd);
 120:	854e                	mv	a0,s3
 122:	00000097          	auipc	ra,0x0
 126:	66a080e7          	jalr	1642(ra) # 78c <close>
}
 12a:	43813083          	ld	ra,1080(sp)
 12e:	43013403          	ld	s0,1072(sp)
 132:	42813483          	ld	s1,1064(sp)
 136:	42013903          	ld	s2,1056(sp)
 13a:	41813983          	ld	s3,1048(sp)
 13e:	41013a03          	ld	s4,1040(sp)
 142:	40813a83          	ld	s5,1032(sp)
 146:	44010113          	addi	sp,sp,1088
 14a:	8082                	ret
    printf("test0: inc too large\n");
 14c:	00001517          	auipc	a0,0x1
 150:	b7450513          	addi	a0,a0,-1164 # cc0 <malloc+0x11c>
 154:	00001097          	auipc	ra,0x1
 158:	990080e7          	jalr	-1648(ra) # ae4 <printf>
    exit(-1);
 15c:	557d                	li	a0,-1
 15e:	00000097          	auipc	ra,0x0
 162:	606080e7          	jalr	1542(ra) # 764 <exit>
    printf("test0 open %s failed\n", file);
 166:	85d6                	mv	a1,s5
 168:	00001517          	auipc	a0,0x1
 16c:	b7050513          	addi	a0,a0,-1168 # cd8 <malloc+0x134>
 170:	00001097          	auipc	ra,0x1
 174:	974080e7          	jalr	-1676(ra) # ae4 <printf>
    exit(-1);
 178:	557d                	li	a0,-1
 17a:	00000097          	auipc	ra,0x0
 17e:	5ea080e7          	jalr	1514(ra) # 764 <exit>
      printf("read %s failed for block %d (%d)\n", file, i, nbytes);
 182:	86d2                	mv	a3,s4
 184:	864a                	mv	a2,s2
 186:	85d6                	mv	a1,s5
 188:	00001517          	auipc	a0,0x1
 18c:	b6850513          	addi	a0,a0,-1176 # cf0 <malloc+0x14c>
 190:	00001097          	auipc	ra,0x1
 194:	954080e7          	jalr	-1708(ra) # ae4 <printf>
      exit(-1);
 198:	557d                	li	a0,-1
 19a:	00000097          	auipc	ra,0x0
 19e:	5ca080e7          	jalr	1482(ra) # 764 <exit>

00000000000001a2 <test0>:

void
test0()
{
 1a2:	7139                	addi	sp,sp,-64
 1a4:	fc06                	sd	ra,56(sp)
 1a6:	f822                	sd	s0,48(sp)
 1a8:	f426                	sd	s1,40(sp)
 1aa:	f04a                	sd	s2,32(sp)
 1ac:	ec4e                	sd	s3,24(sp)
 1ae:	0080                	addi	s0,sp,64
  char file[2];
  char dir[2];
  enum { N = 10, NCHILD = 3 };
  int n;

  dir[0] = '0';
 1b0:	03000793          	li	a5,48
 1b4:	fcf40023          	sb	a5,-64(s0)
  dir[1] = '\0';
 1b8:	fc0400a3          	sb	zero,-63(s0)
  file[0] = 'F';
 1bc:	04600793          	li	a5,70
 1c0:	fcf40423          	sb	a5,-56(s0)
  file[1] = '\0';
 1c4:	fc0404a3          	sb	zero,-55(s0)

  printf("start test0\n");
 1c8:	00001517          	auipc	a0,0x1
 1cc:	b5050513          	addi	a0,a0,-1200 # d18 <malloc+0x174>
 1d0:	00001097          	auipc	ra,0x1
 1d4:	914080e7          	jalr	-1772(ra) # ae4 <printf>
 1d8:	03000493          	li	s1,48
      printf("chdir failed\n");
      exit(1);
    }
    unlink(file);
    createfile(file, N);
    if (chdir("..") < 0) {
 1dc:	00001997          	auipc	s3,0x1
 1e0:	b5c98993          	addi	s3,s3,-1188 # d38 <malloc+0x194>
  for(int i = 0; i < NCHILD; i++){
 1e4:	03300913          	li	s2,51
    dir[0] = '0' + i;
 1e8:	fc940023          	sb	s1,-64(s0)
    mkdir(dir);
 1ec:	fc040513          	addi	a0,s0,-64
 1f0:	00000097          	auipc	ra,0x0
 1f4:	5dc080e7          	jalr	1500(ra) # 7cc <mkdir>
    if (chdir(dir) < 0) {
 1f8:	fc040513          	addi	a0,s0,-64
 1fc:	00000097          	auipc	ra,0x0
 200:	5d8080e7          	jalr	1496(ra) # 7d4 <chdir>
 204:	0c054163          	bltz	a0,2c6 <test0+0x124>
    unlink(file);
 208:	fc840513          	addi	a0,s0,-56
 20c:	00000097          	auipc	ra,0x0
 210:	5a8080e7          	jalr	1448(ra) # 7b4 <unlink>
    createfile(file, N);
 214:	45a9                	li	a1,10
 216:	fc840513          	addi	a0,s0,-56
 21a:	00000097          	auipc	ra,0x0
 21e:	de6080e7          	jalr	-538(ra) # 0 <createfile>
    if (chdir("..") < 0) {
 222:	854e                	mv	a0,s3
 224:	00000097          	auipc	ra,0x0
 228:	5b0080e7          	jalr	1456(ra) # 7d4 <chdir>
 22c:	0a054a63          	bltz	a0,2e0 <test0+0x13e>
  for(int i = 0; i < NCHILD; i++){
 230:	2485                	addiw	s1,s1,1
 232:	0ff4f493          	andi	s1,s1,255
 236:	fb2499e3          	bne	s1,s2,1e8 <test0+0x46>
      printf("chdir failed\n");
      exit(1);
    }
  }
  ntas(0);
 23a:	4501                	li	a0,0
 23c:	00000097          	auipc	ra,0x0
 240:	5c8080e7          	jalr	1480(ra) # 804 <ntas>
 244:	03000493          	li	s1,48
  for(int i = 0; i < NCHILD; i++){
 248:	03300913          	li	s2,51
    dir[0] = '0' + i;
 24c:	fc940023          	sb	s1,-64(s0)
    int pid = fork();
 250:	00000097          	auipc	ra,0x0
 254:	50c080e7          	jalr	1292(ra) # 75c <fork>
    if(pid < 0){
 258:	0a054163          	bltz	a0,2fa <test0+0x158>
      printf("fork failed");
      exit(-1);
    }
    if(pid == 0){
 25c:	cd45                	beqz	a0,314 <test0+0x172>
  for(int i = 0; i < NCHILD; i++){
 25e:	2485                	addiw	s1,s1,1
 260:	0ff4f493          	andi	s1,s1,255
 264:	ff2494e3          	bne	s1,s2,24c <test0+0xaa>
      exit(0);
    }
  }

  for(int i = 0; i < NCHILD; i++){
    wait(0);
 268:	4501                	li	a0,0
 26a:	00000097          	auipc	ra,0x0
 26e:	502080e7          	jalr	1282(ra) # 76c <wait>
 272:	4501                	li	a0,0
 274:	00000097          	auipc	ra,0x0
 278:	4f8080e7          	jalr	1272(ra) # 76c <wait>
 27c:	4501                	li	a0,0
 27e:	00000097          	auipc	ra,0x0
 282:	4ee080e7          	jalr	1262(ra) # 76c <wait>
  }
  printf("test0 results:\n");
 286:	00001517          	auipc	a0,0x1
 28a:	aca50513          	addi	a0,a0,-1334 # d50 <malloc+0x1ac>
 28e:	00001097          	auipc	ra,0x1
 292:	856080e7          	jalr	-1962(ra) # ae4 <printf>
  n = ntas(1);
 296:	4505                	li	a0,1
 298:	00000097          	auipc	ra,0x0
 29c:	56c080e7          	jalr	1388(ra) # 804 <ntas>
  if (n < 500)
 2a0:	1f300793          	li	a5,499
 2a4:	0aa7cc63          	blt	a5,a0,35c <test0+0x1ba>
    printf("test0: OK\n");
 2a8:	00001517          	auipc	a0,0x1
 2ac:	ab850513          	addi	a0,a0,-1352 # d60 <malloc+0x1bc>
 2b0:	00001097          	auipc	ra,0x1
 2b4:	834080e7          	jalr	-1996(ra) # ae4 <printf>
  else
    printf("test0: FAIL\n");
}
 2b8:	70e2                	ld	ra,56(sp)
 2ba:	7442                	ld	s0,48(sp)
 2bc:	74a2                	ld	s1,40(sp)
 2be:	7902                	ld	s2,32(sp)
 2c0:	69e2                	ld	s3,24(sp)
 2c2:	6121                	addi	sp,sp,64
 2c4:	8082                	ret
      printf("chdir failed\n");
 2c6:	00001517          	auipc	a0,0x1
 2ca:	a6250513          	addi	a0,a0,-1438 # d28 <malloc+0x184>
 2ce:	00001097          	auipc	ra,0x1
 2d2:	816080e7          	jalr	-2026(ra) # ae4 <printf>
      exit(1);
 2d6:	4505                	li	a0,1
 2d8:	00000097          	auipc	ra,0x0
 2dc:	48c080e7          	jalr	1164(ra) # 764 <exit>
      printf("chdir failed\n");
 2e0:	00001517          	auipc	a0,0x1
 2e4:	a4850513          	addi	a0,a0,-1464 # d28 <malloc+0x184>
 2e8:	00000097          	auipc	ra,0x0
 2ec:	7fc080e7          	jalr	2044(ra) # ae4 <printf>
      exit(1);
 2f0:	4505                	li	a0,1
 2f2:	00000097          	auipc	ra,0x0
 2f6:	472080e7          	jalr	1138(ra) # 764 <exit>
      printf("fork failed");
 2fa:	00001517          	auipc	a0,0x1
 2fe:	a4650513          	addi	a0,a0,-1466 # d40 <malloc+0x19c>
 302:	00000097          	auipc	ra,0x0
 306:	7e2080e7          	jalr	2018(ra) # ae4 <printf>
      exit(-1);
 30a:	557d                	li	a0,-1
 30c:	00000097          	auipc	ra,0x0
 310:	458080e7          	jalr	1112(ra) # 764 <exit>
      if (chdir(dir) < 0) {
 314:	fc040513          	addi	a0,s0,-64
 318:	00000097          	auipc	ra,0x0
 31c:	4bc080e7          	jalr	1212(ra) # 7d4 <chdir>
 320:	02054163          	bltz	a0,342 <test0+0x1a0>
      readfile(file, N*BSIZE, 1);
 324:	4605                	li	a2,1
 326:	658d                	lui	a1,0x3
 328:	80058593          	addi	a1,a1,-2048 # 2800 <__global_pointer$+0x1240>
 32c:	fc840513          	addi	a0,s0,-56
 330:	00000097          	auipc	ra,0x0
 334:	d8c080e7          	jalr	-628(ra) # bc <readfile>
      exit(0);
 338:	4501                	li	a0,0
 33a:	00000097          	auipc	ra,0x0
 33e:	42a080e7          	jalr	1066(ra) # 764 <exit>
        printf("chdir failed\n");
 342:	00001517          	auipc	a0,0x1
 346:	9e650513          	addi	a0,a0,-1562 # d28 <malloc+0x184>
 34a:	00000097          	auipc	ra,0x0
 34e:	79a080e7          	jalr	1946(ra) # ae4 <printf>
        exit(1);
 352:	4505                	li	a0,1
 354:	00000097          	auipc	ra,0x0
 358:	410080e7          	jalr	1040(ra) # 764 <exit>
    printf("test0: FAIL\n");
 35c:	00001517          	auipc	a0,0x1
 360:	a1450513          	addi	a0,a0,-1516 # d70 <malloc+0x1cc>
 364:	00000097          	auipc	ra,0x0
 368:	780080e7          	jalr	1920(ra) # ae4 <printf>
}
 36c:	b7b1                	j	2b8 <test0+0x116>

000000000000036e <test1>:

void test1()
{
 36e:	7179                	addi	sp,sp,-48
 370:	f406                	sd	ra,40(sp)
 372:	f022                	sd	s0,32(sp)
 374:	ec26                	sd	s1,24(sp)
 376:	e84a                	sd	s2,16(sp)
 378:	1800                	addi	s0,sp,48
  char file[3];
  enum { N = 100, BIG=100, NCHILD=2 };
  
  printf("start test1\n");
 37a:	00001517          	auipc	a0,0x1
 37e:	a0650513          	addi	a0,a0,-1530 # d80 <malloc+0x1dc>
 382:	00000097          	auipc	ra,0x0
 386:	762080e7          	jalr	1890(ra) # ae4 <printf>
  file[0] = 'B';
 38a:	04200793          	li	a5,66
 38e:	fcf40c23          	sb	a5,-40(s0)
  file[2] = '\0';
 392:	fc040d23          	sb	zero,-38(s0)
 396:	4485                	li	s1,1
  for(int i = 0; i < NCHILD; i++){
    file[1] = '0' + i;
    unlink(file);
    if (i == 0) {
 398:	4905                	li	s2,1
 39a:	a811                	j	3ae <test1+0x40>
      createfile(file, BIG);
 39c:	06400593          	li	a1,100
 3a0:	fd840513          	addi	a0,s0,-40
 3a4:	00000097          	auipc	ra,0x0
 3a8:	c5c080e7          	jalr	-932(ra) # 0 <createfile>
  for(int i = 0; i < NCHILD; i++){
 3ac:	2485                	addiw	s1,s1,1
    file[1] = '0' + i;
 3ae:	02f4879b          	addiw	a5,s1,47
 3b2:	fcf40ca3          	sb	a5,-39(s0)
    unlink(file);
 3b6:	fd840513          	addi	a0,s0,-40
 3ba:	00000097          	auipc	ra,0x0
 3be:	3fa080e7          	jalr	1018(ra) # 7b4 <unlink>
    if (i == 0) {
 3c2:	fd248de3          	beq	s1,s2,39c <test1+0x2e>
    } else {
      createfile(file, 1);
 3c6:	85ca                	mv	a1,s2
 3c8:	fd840513          	addi	a0,s0,-40
 3cc:	00000097          	auipc	ra,0x0
 3d0:	c34080e7          	jalr	-972(ra) # 0 <createfile>
  for(int i = 0; i < NCHILD; i++){
 3d4:	0004879b          	sext.w	a5,s1
 3d8:	fcf95ae3          	ble	a5,s2,3ac <test1+0x3e>
    }
  }
  for(int i = 0; i < NCHILD; i++){
    file[1] = '0' + i;
 3dc:	03000793          	li	a5,48
 3e0:	fcf40ca3          	sb	a5,-39(s0)
    int pid = fork();
 3e4:	00000097          	auipc	ra,0x0
 3e8:	378080e7          	jalr	888(ra) # 75c <fork>
    if(pid < 0){
 3ec:	04054663          	bltz	a0,438 <test1+0xca>
      printf("fork failed");
      exit(-1);
    }
    if(pid == 0){
 3f0:	c12d                	beqz	a0,452 <test1+0xe4>
    file[1] = '0' + i;
 3f2:	03100793          	li	a5,49
 3f6:	fcf40ca3          	sb	a5,-39(s0)
    int pid = fork();
 3fa:	00000097          	auipc	ra,0x0
 3fe:	362080e7          	jalr	866(ra) # 75c <fork>
    if(pid < 0){
 402:	02054b63          	bltz	a0,438 <test1+0xca>
    if(pid == 0){
 406:	cd35                	beqz	a0,482 <test1+0x114>
      exit(0);
    }
  }

  for(int i = 0; i < NCHILD; i++){
    wait(0);
 408:	4501                	li	a0,0
 40a:	00000097          	auipc	ra,0x0
 40e:	362080e7          	jalr	866(ra) # 76c <wait>
 412:	4501                	li	a0,0
 414:	00000097          	auipc	ra,0x0
 418:	358080e7          	jalr	856(ra) # 76c <wait>
  }
  printf("test1 OK\n");
 41c:	00001517          	auipc	a0,0x1
 420:	97450513          	addi	a0,a0,-1676 # d90 <malloc+0x1ec>
 424:	00000097          	auipc	ra,0x0
 428:	6c0080e7          	jalr	1728(ra) # ae4 <printf>
}
 42c:	70a2                	ld	ra,40(sp)
 42e:	7402                	ld	s0,32(sp)
 430:	64e2                	ld	s1,24(sp)
 432:	6942                	ld	s2,16(sp)
 434:	6145                	addi	sp,sp,48
 436:	8082                	ret
      printf("fork failed");
 438:	00001517          	auipc	a0,0x1
 43c:	90850513          	addi	a0,a0,-1784 # d40 <malloc+0x19c>
 440:	00000097          	auipc	ra,0x0
 444:	6a4080e7          	jalr	1700(ra) # ae4 <printf>
      exit(-1);
 448:	557d                	li	a0,-1
 44a:	00000097          	auipc	ra,0x0
 44e:	31a080e7          	jalr	794(ra) # 764 <exit>
    if(pid == 0){
 452:	06400493          	li	s1,100
          readfile(file, BIG*BSIZE, BSIZE);
 456:	40000613          	li	a2,1024
 45a:	65e5                	lui	a1,0x19
 45c:	fd840513          	addi	a0,s0,-40
 460:	00000097          	auipc	ra,0x0
 464:	c5c080e7          	jalr	-932(ra) # bc <readfile>
        for (i = 0; i < N; i++) {
 468:	34fd                	addiw	s1,s1,-1
 46a:	f4f5                	bnez	s1,456 <test1+0xe8>
        unlink(file);
 46c:	fd840513          	addi	a0,s0,-40
 470:	00000097          	auipc	ra,0x0
 474:	344080e7          	jalr	836(ra) # 7b4 <unlink>
        exit(0);
 478:	4501                	li	a0,0
 47a:	00000097          	auipc	ra,0x0
 47e:	2ea080e7          	jalr	746(ra) # 764 <exit>
 482:	06400493          	li	s1,100
          readfile(file, 1, BSIZE);
 486:	40000613          	li	a2,1024
 48a:	4585                	li	a1,1
 48c:	fd840513          	addi	a0,s0,-40
 490:	00000097          	auipc	ra,0x0
 494:	c2c080e7          	jalr	-980(ra) # bc <readfile>
        for (i = 0; i < N; i++) {
 498:	34fd                	addiw	s1,s1,-1
 49a:	f4f5                	bnez	s1,486 <test1+0x118>
        unlink(file);
 49c:	fd840513          	addi	a0,s0,-40
 4a0:	00000097          	auipc	ra,0x0
 4a4:	314080e7          	jalr	788(ra) # 7b4 <unlink>
      exit(0);
 4a8:	4501                	li	a0,0
 4aa:	00000097          	auipc	ra,0x0
 4ae:	2ba080e7          	jalr	698(ra) # 764 <exit>

00000000000004b2 <main>:
{
 4b2:	1141                	addi	sp,sp,-16
 4b4:	e406                	sd	ra,8(sp)
 4b6:	e022                	sd	s0,0(sp)
 4b8:	0800                	addi	s0,sp,16
  test0();
 4ba:	00000097          	auipc	ra,0x0
 4be:	ce8080e7          	jalr	-792(ra) # 1a2 <test0>
  test1();
 4c2:	00000097          	auipc	ra,0x0
 4c6:	eac080e7          	jalr	-340(ra) # 36e <test1>
  exit(0);
 4ca:	4501                	li	a0,0
 4cc:	00000097          	auipc	ra,0x0
 4d0:	298080e7          	jalr	664(ra) # 764 <exit>

00000000000004d4 <strcpy>:
#include "kernel/fcntl.h"
#include "user/user.h"

char*
strcpy(char *s, const char *t)
{
 4d4:	1141                	addi	sp,sp,-16
 4d6:	e422                	sd	s0,8(sp)
 4d8:	0800                	addi	s0,sp,16
  char *os;

  os = s;
  while((*s++ = *t++) != 0)
 4da:	87aa                	mv	a5,a0
 4dc:	0585                	addi	a1,a1,1
 4de:	0785                	addi	a5,a5,1
 4e0:	fff5c703          	lbu	a4,-1(a1) # 18fff <__global_pointer$+0x17a3f>
 4e4:	fee78fa3          	sb	a4,-1(a5)
 4e8:	fb75                	bnez	a4,4dc <strcpy+0x8>
    ;
  return os;
}
 4ea:	6422                	ld	s0,8(sp)
 4ec:	0141                	addi	sp,sp,16
 4ee:	8082                	ret

00000000000004f0 <strcmp>:

int
strcmp(const char *p, const char *q)
{
 4f0:	1141                	addi	sp,sp,-16
 4f2:	e422                	sd	s0,8(sp)
 4f4:	0800                	addi	s0,sp,16
  while(*p && *p == *q)
 4f6:	00054783          	lbu	a5,0(a0)
 4fa:	cf91                	beqz	a5,516 <strcmp+0x26>
 4fc:	0005c703          	lbu	a4,0(a1)
 500:	00f71b63          	bne	a4,a5,516 <strcmp+0x26>
    p++, q++;
 504:	0505                	addi	a0,a0,1
 506:	0585                	addi	a1,a1,1
  while(*p && *p == *q)
 508:	00054783          	lbu	a5,0(a0)
 50c:	c789                	beqz	a5,516 <strcmp+0x26>
 50e:	0005c703          	lbu	a4,0(a1)
 512:	fef709e3          	beq	a4,a5,504 <strcmp+0x14>
  return (uchar)*p - (uchar)*q;
 516:	0005c503          	lbu	a0,0(a1)
}
 51a:	40a7853b          	subw	a0,a5,a0
 51e:	6422                	ld	s0,8(sp)
 520:	0141                	addi	sp,sp,16
 522:	8082                	ret

0000000000000524 <strlen>:

uint
strlen(const char *s)
{
 524:	1141                	addi	sp,sp,-16
 526:	e422                	sd	s0,8(sp)
 528:	0800                	addi	s0,sp,16
  int n;

  for(n = 0; s[n]; n++)
 52a:	00054783          	lbu	a5,0(a0)
 52e:	cf91                	beqz	a5,54a <strlen+0x26>
 530:	0505                	addi	a0,a0,1
 532:	87aa                	mv	a5,a0
 534:	4685                	li	a3,1
 536:	9e89                	subw	a3,a3,a0
 538:	00f6853b          	addw	a0,a3,a5
 53c:	0785                	addi	a5,a5,1
 53e:	fff7c703          	lbu	a4,-1(a5)
 542:	fb7d                	bnez	a4,538 <strlen+0x14>
    ;
  return n;
}
 544:	6422                	ld	s0,8(sp)
 546:	0141                	addi	sp,sp,16
 548:	8082                	ret
  for(n = 0; s[n]; n++)
 54a:	4501                	li	a0,0
 54c:	bfe5                	j	544 <strlen+0x20>

000000000000054e <memset>:

void*
memset(void *dst, int c, uint n)
{
 54e:	1141                	addi	sp,sp,-16
 550:	e422                	sd	s0,8(sp)
 552:	0800                	addi	s0,sp,16
  char *cdst = (char *) dst;
  int i;
  for(i = 0; i < n; i++){
 554:	ce09                	beqz	a2,56e <memset+0x20>
 556:	87aa                	mv	a5,a0
 558:	fff6071b          	addiw	a4,a2,-1
 55c:	1702                	slli	a4,a4,0x20
 55e:	9301                	srli	a4,a4,0x20
 560:	0705                	addi	a4,a4,1
 562:	972a                	add	a4,a4,a0
    cdst[i] = c;
 564:	00b78023          	sb	a1,0(a5)
  for(i = 0; i < n; i++){
 568:	0785                	addi	a5,a5,1
 56a:	fee79de3          	bne	a5,a4,564 <memset+0x16>
  }
  return dst;
}
 56e:	6422                	ld	s0,8(sp)
 570:	0141                	addi	sp,sp,16
 572:	8082                	ret

0000000000000574 <strchr>:

char*
strchr(const char *s, char c)
{
 574:	1141                	addi	sp,sp,-16
 576:	e422                	sd	s0,8(sp)
 578:	0800                	addi	s0,sp,16
  for(; *s; s++)
 57a:	00054783          	lbu	a5,0(a0)
 57e:	cf91                	beqz	a5,59a <strchr+0x26>
    if(*s == c)
 580:	00f58a63          	beq	a1,a5,594 <strchr+0x20>
  for(; *s; s++)
 584:	0505                	addi	a0,a0,1
 586:	00054783          	lbu	a5,0(a0)
 58a:	c781                	beqz	a5,592 <strchr+0x1e>
    if(*s == c)
 58c:	feb79ce3          	bne	a5,a1,584 <strchr+0x10>
 590:	a011                	j	594 <strchr+0x20>
      return (char*)s;
  return 0;
 592:	4501                	li	a0,0
}
 594:	6422                	ld	s0,8(sp)
 596:	0141                	addi	sp,sp,16
 598:	8082                	ret
  return 0;
 59a:	4501                	li	a0,0
 59c:	bfe5                	j	594 <strchr+0x20>

000000000000059e <gets>:

char*
gets(char *buf, int max)
{
 59e:	711d                	addi	sp,sp,-96
 5a0:	ec86                	sd	ra,88(sp)
 5a2:	e8a2                	sd	s0,80(sp)
 5a4:	e4a6                	sd	s1,72(sp)
 5a6:	e0ca                	sd	s2,64(sp)
 5a8:	fc4e                	sd	s3,56(sp)
 5aa:	f852                	sd	s4,48(sp)
 5ac:	f456                	sd	s5,40(sp)
 5ae:	f05a                	sd	s6,32(sp)
 5b0:	ec5e                	sd	s7,24(sp)
 5b2:	1080                	addi	s0,sp,96
 5b4:	8baa                	mv	s7,a0
 5b6:	8a2e                	mv	s4,a1
  int i, cc;
  char c;

  for(i=0; i+1 < max; ){
 5b8:	892a                	mv	s2,a0
 5ba:	4981                	li	s3,0
    cc = read(0, &c, 1);
    if(cc < 1)
      break;
    buf[i++] = c;
    if(c == '\n' || c == '\r')
 5bc:	4aa9                	li	s5,10
 5be:	4b35                	li	s6,13
  for(i=0; i+1 < max; ){
 5c0:	0019849b          	addiw	s1,s3,1
 5c4:	0344d863          	ble	s4,s1,5f4 <gets+0x56>
    cc = read(0, &c, 1);
 5c8:	4605                	li	a2,1
 5ca:	faf40593          	addi	a1,s0,-81
 5ce:	4501                	li	a0,0
 5d0:	00000097          	auipc	ra,0x0
 5d4:	1ac080e7          	jalr	428(ra) # 77c <read>
    if(cc < 1)
 5d8:	00a05e63          	blez	a0,5f4 <gets+0x56>
    buf[i++] = c;
 5dc:	faf44783          	lbu	a5,-81(s0)
 5e0:	00f90023          	sb	a5,0(s2)
    if(c == '\n' || c == '\r')
 5e4:	01578763          	beq	a5,s5,5f2 <gets+0x54>
 5e8:	0905                	addi	s2,s2,1
  for(i=0; i+1 < max; ){
 5ea:	89a6                	mv	s3,s1
    if(c == '\n' || c == '\r')
 5ec:	fd679ae3          	bne	a5,s6,5c0 <gets+0x22>
 5f0:	a011                	j	5f4 <gets+0x56>
  for(i=0; i+1 < max; ){
 5f2:	89a6                	mv	s3,s1
      break;
  }
  buf[i] = '\0';
 5f4:	99de                	add	s3,s3,s7
 5f6:	00098023          	sb	zero,0(s3)
  return buf;
}
 5fa:	855e                	mv	a0,s7
 5fc:	60e6                	ld	ra,88(sp)
 5fe:	6446                	ld	s0,80(sp)
 600:	64a6                	ld	s1,72(sp)
 602:	6906                	ld	s2,64(sp)
 604:	79e2                	ld	s3,56(sp)
 606:	7a42                	ld	s4,48(sp)
 608:	7aa2                	ld	s5,40(sp)
 60a:	7b02                	ld	s6,32(sp)
 60c:	6be2                	ld	s7,24(sp)
 60e:	6125                	addi	sp,sp,96
 610:	8082                	ret

0000000000000612 <stat>:

int
stat(const char *n, struct stat *st)
{
 612:	1101                	addi	sp,sp,-32
 614:	ec06                	sd	ra,24(sp)
 616:	e822                	sd	s0,16(sp)
 618:	e426                	sd	s1,8(sp)
 61a:	e04a                	sd	s2,0(sp)
 61c:	1000                	addi	s0,sp,32
 61e:	892e                	mv	s2,a1
  int fd;
  int r;

  fd = open(n, O_RDONLY);
 620:	4581                	li	a1,0
 622:	00000097          	auipc	ra,0x0
 626:	182080e7          	jalr	386(ra) # 7a4 <open>
  if(fd < 0)
 62a:	02054563          	bltz	a0,654 <stat+0x42>
 62e:	84aa                	mv	s1,a0
    return -1;
  r = fstat(fd, st);
 630:	85ca                	mv	a1,s2
 632:	00000097          	auipc	ra,0x0
 636:	18a080e7          	jalr	394(ra) # 7bc <fstat>
 63a:	892a                	mv	s2,a0
  close(fd);
 63c:	8526                	mv	a0,s1
 63e:	00000097          	auipc	ra,0x0
 642:	14e080e7          	jalr	334(ra) # 78c <close>
  return r;
}
 646:	854a                	mv	a0,s2
 648:	60e2                	ld	ra,24(sp)
 64a:	6442                	ld	s0,16(sp)
 64c:	64a2                	ld	s1,8(sp)
 64e:	6902                	ld	s2,0(sp)
 650:	6105                	addi	sp,sp,32
 652:	8082                	ret
    return -1;
 654:	597d                	li	s2,-1
 656:	bfc5                	j	646 <stat+0x34>

0000000000000658 <atoi>:

int
atoi(const char *s)
{
 658:	1141                	addi	sp,sp,-16
 65a:	e422                	sd	s0,8(sp)
 65c:	0800                	addi	s0,sp,16
  int n;

  n = 0;
  while('0' <= *s && *s <= '9')
 65e:	00054683          	lbu	a3,0(a0)
 662:	fd06879b          	addiw	a5,a3,-48
 666:	0ff7f793          	andi	a5,a5,255
 66a:	4725                	li	a4,9
 66c:	02f76963          	bltu	a4,a5,69e <atoi+0x46>
 670:	862a                	mv	a2,a0
  n = 0;
 672:	4501                	li	a0,0
  while('0' <= *s && *s <= '9')
 674:	45a5                	li	a1,9
    n = n*10 + *s++ - '0';
 676:	0605                	addi	a2,a2,1
 678:	0025179b          	slliw	a5,a0,0x2
 67c:	9fa9                	addw	a5,a5,a0
 67e:	0017979b          	slliw	a5,a5,0x1
 682:	9fb5                	addw	a5,a5,a3
 684:	fd07851b          	addiw	a0,a5,-48
  while('0' <= *s && *s <= '9')
 688:	00064683          	lbu	a3,0(a2)
 68c:	fd06871b          	addiw	a4,a3,-48
 690:	0ff77713          	andi	a4,a4,255
 694:	fee5f1e3          	bleu	a4,a1,676 <atoi+0x1e>
  return n;
}
 698:	6422                	ld	s0,8(sp)
 69a:	0141                	addi	sp,sp,16
 69c:	8082                	ret
  n = 0;
 69e:	4501                	li	a0,0
 6a0:	bfe5                	j	698 <atoi+0x40>

00000000000006a2 <memmove>:

void*
memmove(void *vdst, const void *vsrc, int n)
{
 6a2:	1141                	addi	sp,sp,-16
 6a4:	e422                	sd	s0,8(sp)
 6a6:	0800                	addi	s0,sp,16
  char *dst;
  const char *src;

  dst = vdst;
  src = vsrc;
  if (src > dst) {
 6a8:	02b57663          	bleu	a1,a0,6d4 <memmove+0x32>
    while(n-- > 0)
 6ac:	02c05163          	blez	a2,6ce <memmove+0x2c>
 6b0:	fff6079b          	addiw	a5,a2,-1
 6b4:	1782                	slli	a5,a5,0x20
 6b6:	9381                	srli	a5,a5,0x20
 6b8:	0785                	addi	a5,a5,1
 6ba:	97aa                	add	a5,a5,a0
  dst = vdst;
 6bc:	872a                	mv	a4,a0
      *dst++ = *src++;
 6be:	0585                	addi	a1,a1,1
 6c0:	0705                	addi	a4,a4,1
 6c2:	fff5c683          	lbu	a3,-1(a1)
 6c6:	fed70fa3          	sb	a3,-1(a4)
    while(n-- > 0)
 6ca:	fee79ae3          	bne	a5,a4,6be <memmove+0x1c>
    src += n;
    while(n-- > 0)
      *--dst = *--src;
  }
  return vdst;
}
 6ce:	6422                	ld	s0,8(sp)
 6d0:	0141                	addi	sp,sp,16
 6d2:	8082                	ret
    dst += n;
 6d4:	00c50733          	add	a4,a0,a2
    src += n;
 6d8:	95b2                	add	a1,a1,a2
    while(n-- > 0)
 6da:	fec05ae3          	blez	a2,6ce <memmove+0x2c>
 6de:	fff6079b          	addiw	a5,a2,-1
 6e2:	1782                	slli	a5,a5,0x20
 6e4:	9381                	srli	a5,a5,0x20
 6e6:	fff7c793          	not	a5,a5
 6ea:	97ba                	add	a5,a5,a4
      *--dst = *--src;
 6ec:	15fd                	addi	a1,a1,-1
 6ee:	177d                	addi	a4,a4,-1
 6f0:	0005c683          	lbu	a3,0(a1)
 6f4:	00d70023          	sb	a3,0(a4)
    while(n-- > 0)
 6f8:	fef71ae3          	bne	a4,a5,6ec <memmove+0x4a>
 6fc:	bfc9                	j	6ce <memmove+0x2c>

00000000000006fe <memcmp>:

int
memcmp(const void *s1, const void *s2, uint n)
{
 6fe:	1141                	addi	sp,sp,-16
 700:	e422                	sd	s0,8(sp)
 702:	0800                	addi	s0,sp,16
  const char *p1 = s1, *p2 = s2;
  while (n-- > 0) {
 704:	ce15                	beqz	a2,740 <memcmp+0x42>
 706:	fff6069b          	addiw	a3,a2,-1
    if (*p1 != *p2) {
 70a:	00054783          	lbu	a5,0(a0)
 70e:	0005c703          	lbu	a4,0(a1)
 712:	02e79063          	bne	a5,a4,732 <memcmp+0x34>
 716:	1682                	slli	a3,a3,0x20
 718:	9281                	srli	a3,a3,0x20
 71a:	0685                	addi	a3,a3,1
 71c:	96aa                	add	a3,a3,a0
      return *p1 - *p2;
    }
    p1++;
 71e:	0505                	addi	a0,a0,1
    p2++;
 720:	0585                	addi	a1,a1,1
  while (n-- > 0) {
 722:	00d50d63          	beq	a0,a3,73c <memcmp+0x3e>
    if (*p1 != *p2) {
 726:	00054783          	lbu	a5,0(a0)
 72a:	0005c703          	lbu	a4,0(a1)
 72e:	fee788e3          	beq	a5,a4,71e <memcmp+0x20>
      return *p1 - *p2;
 732:	40e7853b          	subw	a0,a5,a4
  }
  return 0;
}
 736:	6422                	ld	s0,8(sp)
 738:	0141                	addi	sp,sp,16
 73a:	8082                	ret
  return 0;
 73c:	4501                	li	a0,0
 73e:	bfe5                	j	736 <memcmp+0x38>
 740:	4501                	li	a0,0
 742:	bfd5                	j	736 <memcmp+0x38>

0000000000000744 <memcpy>:

void *
memcpy(void *dst, const void *src, uint n)
{
 744:	1141                	addi	sp,sp,-16
 746:	e406                	sd	ra,8(sp)
 748:	e022                	sd	s0,0(sp)
 74a:	0800                	addi	s0,sp,16
  return memmove(dst, src, n);
 74c:	00000097          	auipc	ra,0x0
 750:	f56080e7          	jalr	-170(ra) # 6a2 <memmove>
}
 754:	60a2                	ld	ra,8(sp)
 756:	6402                	ld	s0,0(sp)
 758:	0141                	addi	sp,sp,16
 75a:	8082                	ret

000000000000075c <fork>:
# generated by usys.pl - do not edit
#include "kernel/syscall.h"
.global fork
fork:
 li a7, SYS_fork
 75c:	4885                	li	a7,1
 ecall
 75e:	00000073          	ecall
 ret
 762:	8082                	ret

0000000000000764 <exit>:
.global exit
exit:
 li a7, SYS_exit
 764:	4889                	li	a7,2
 ecall
 766:	00000073          	ecall
 ret
 76a:	8082                	ret

000000000000076c <wait>:
.global wait
wait:
 li a7, SYS_wait
 76c:	488d                	li	a7,3
 ecall
 76e:	00000073          	ecall
 ret
 772:	8082                	ret

0000000000000774 <pipe>:
.global pipe
pipe:
 li a7, SYS_pipe
 774:	4891                	li	a7,4
 ecall
 776:	00000073          	ecall
 ret
 77a:	8082                	ret

000000000000077c <read>:
.global read
read:
 li a7, SYS_read
 77c:	4895                	li	a7,5
 ecall
 77e:	00000073          	ecall
 ret
 782:	8082                	ret

0000000000000784 <write>:
.global write
write:
 li a7, SYS_write
 784:	48c1                	li	a7,16
 ecall
 786:	00000073          	ecall
 ret
 78a:	8082                	ret

000000000000078c <close>:
.global close
close:
 li a7, SYS_close
 78c:	48d5                	li	a7,21
 ecall
 78e:	00000073          	ecall
 ret
 792:	8082                	ret

0000000000000794 <kill>:
.global kill
kill:
 li a7, SYS_kill
 794:	4899                	li	a7,6
 ecall
 796:	00000073          	ecall
 ret
 79a:	8082                	ret

000000000000079c <exec>:
.global exec
exec:
 li a7, SYS_exec
 79c:	489d                	li	a7,7
 ecall
 79e:	00000073          	ecall
 ret
 7a2:	8082                	ret

00000000000007a4 <open>:
.global open
open:
 li a7, SYS_open
 7a4:	48bd                	li	a7,15
 ecall
 7a6:	00000073          	ecall
 ret
 7aa:	8082                	ret

00000000000007ac <mknod>:
.global mknod
mknod:
 li a7, SYS_mknod
 7ac:	48c5                	li	a7,17
 ecall
 7ae:	00000073          	ecall
 ret
 7b2:	8082                	ret

00000000000007b4 <unlink>:
.global unlink
unlink:
 li a7, SYS_unlink
 7b4:	48c9                	li	a7,18
 ecall
 7b6:	00000073          	ecall
 ret
 7ba:	8082                	ret

00000000000007bc <fstat>:
.global fstat
fstat:
 li a7, SYS_fstat
 7bc:	48a1                	li	a7,8
 ecall
 7be:	00000073          	ecall
 ret
 7c2:	8082                	ret

00000000000007c4 <link>:
.global link
link:
 li a7, SYS_link
 7c4:	48cd                	li	a7,19
 ecall
 7c6:	00000073          	ecall
 ret
 7ca:	8082                	ret

00000000000007cc <mkdir>:
.global mkdir
mkdir:
 li a7, SYS_mkdir
 7cc:	48d1                	li	a7,20
 ecall
 7ce:	00000073          	ecall
 ret
 7d2:	8082                	ret

00000000000007d4 <chdir>:
.global chdir
chdir:
 li a7, SYS_chdir
 7d4:	48a5                	li	a7,9
 ecall
 7d6:	00000073          	ecall
 ret
 7da:	8082                	ret

00000000000007dc <dup>:
.global dup
dup:
 li a7, SYS_dup
 7dc:	48a9                	li	a7,10
 ecall
 7de:	00000073          	ecall
 ret
 7e2:	8082                	ret

00000000000007e4 <getpid>:
.global getpid
getpid:
 li a7, SYS_getpid
 7e4:	48ad                	li	a7,11
 ecall
 7e6:	00000073          	ecall
 ret
 7ea:	8082                	ret

00000000000007ec <sbrk>:
.global sbrk
sbrk:
 li a7, SYS_sbrk
 7ec:	48b1                	li	a7,12
 ecall
 7ee:	00000073          	ecall
 ret
 7f2:	8082                	ret

00000000000007f4 <sleep>:
.global sleep
sleep:
 li a7, SYS_sleep
 7f4:	48b5                	li	a7,13
 ecall
 7f6:	00000073          	ecall
 ret
 7fa:	8082                	ret

00000000000007fc <uptime>:
.global uptime
uptime:
 li a7, SYS_uptime
 7fc:	48b9                	li	a7,14
 ecall
 7fe:	00000073          	ecall
 ret
 802:	8082                	ret

0000000000000804 <ntas>:
.global ntas
ntas:
 li a7, SYS_ntas
 804:	48d9                	li	a7,22
 ecall
 806:	00000073          	ecall
 ret
 80a:	8082                	ret

000000000000080c <putc>:

static char digits[] = "0123456789ABCDEF";

static void
putc(int fd, char c)
{
 80c:	1101                	addi	sp,sp,-32
 80e:	ec06                	sd	ra,24(sp)
 810:	e822                	sd	s0,16(sp)
 812:	1000                	addi	s0,sp,32
 814:	feb407a3          	sb	a1,-17(s0)
  write(fd, &c, 1);
 818:	4605                	li	a2,1
 81a:	fef40593          	addi	a1,s0,-17
 81e:	00000097          	auipc	ra,0x0
 822:	f66080e7          	jalr	-154(ra) # 784 <write>
}
 826:	60e2                	ld	ra,24(sp)
 828:	6442                	ld	s0,16(sp)
 82a:	6105                	addi	sp,sp,32
 82c:	8082                	ret

000000000000082e <printint>:

static void
printint(int fd, int xx, int base, int sgn)
{
 82e:	7139                	addi	sp,sp,-64
 830:	fc06                	sd	ra,56(sp)
 832:	f822                	sd	s0,48(sp)
 834:	f426                	sd	s1,40(sp)
 836:	f04a                	sd	s2,32(sp)
 838:	ec4e                	sd	s3,24(sp)
 83a:	0080                	addi	s0,sp,64
  char buf[16];
  int i, neg;
  uint x;

  neg = 0;
  if(sgn && xx < 0){
 83c:	c299                	beqz	a3,842 <printint+0x14>
 83e:	0005cd63          	bltz	a1,858 <printint+0x2a>
    neg = 1;
    x = -xx;
  } else {
    x = xx;
 842:	2581                	sext.w	a1,a1
  neg = 0;
 844:	4301                	li	t1,0
 846:	fc040713          	addi	a4,s0,-64
  }

  i = 0;
 84a:	4801                	li	a6,0
  do{
    buf[i++] = digits[x % base];
 84c:	2601                	sext.w	a2,a2
 84e:	00000897          	auipc	a7,0x0
 852:	55288893          	addi	a7,a7,1362 # da0 <digits>
 856:	a801                	j	866 <printint+0x38>
    x = -xx;
 858:	40b005bb          	negw	a1,a1
 85c:	2581                	sext.w	a1,a1
    neg = 1;
 85e:	4305                	li	t1,1
    x = -xx;
 860:	b7dd                	j	846 <printint+0x18>
  }while((x /= base) != 0);
 862:	85be                	mv	a1,a5
    buf[i++] = digits[x % base];
 864:	8836                	mv	a6,a3
 866:	0018069b          	addiw	a3,a6,1
 86a:	02c5f7bb          	remuw	a5,a1,a2
 86e:	1782                	slli	a5,a5,0x20
 870:	9381                	srli	a5,a5,0x20
 872:	97c6                	add	a5,a5,a7
 874:	0007c783          	lbu	a5,0(a5)
 878:	00f70023          	sb	a5,0(a4)
  }while((x /= base) != 0);
 87c:	0705                	addi	a4,a4,1
 87e:	02c5d7bb          	divuw	a5,a1,a2
 882:	fec5f0e3          	bleu	a2,a1,862 <printint+0x34>
  if(neg)
 886:	00030b63          	beqz	t1,89c <printint+0x6e>
    buf[i++] = '-';
 88a:	fd040793          	addi	a5,s0,-48
 88e:	96be                	add	a3,a3,a5
 890:	02d00793          	li	a5,45
 894:	fef68823          	sb	a5,-16(a3)
 898:	0028069b          	addiw	a3,a6,2

  while(--i >= 0)
 89c:	02d05963          	blez	a3,8ce <printint+0xa0>
 8a0:	89aa                	mv	s3,a0
 8a2:	fc040793          	addi	a5,s0,-64
 8a6:	00d784b3          	add	s1,a5,a3
 8aa:	fff78913          	addi	s2,a5,-1
 8ae:	9936                	add	s2,s2,a3
 8b0:	36fd                	addiw	a3,a3,-1
 8b2:	1682                	slli	a3,a3,0x20
 8b4:	9281                	srli	a3,a3,0x20
 8b6:	40d90933          	sub	s2,s2,a3
    putc(fd, buf[i]);
 8ba:	fff4c583          	lbu	a1,-1(s1)
 8be:	854e                	mv	a0,s3
 8c0:	00000097          	auipc	ra,0x0
 8c4:	f4c080e7          	jalr	-180(ra) # 80c <putc>
  while(--i >= 0)
 8c8:	14fd                	addi	s1,s1,-1
 8ca:	ff2498e3          	bne	s1,s2,8ba <printint+0x8c>
}
 8ce:	70e2                	ld	ra,56(sp)
 8d0:	7442                	ld	s0,48(sp)
 8d2:	74a2                	ld	s1,40(sp)
 8d4:	7902                	ld	s2,32(sp)
 8d6:	69e2                	ld	s3,24(sp)
 8d8:	6121                	addi	sp,sp,64
 8da:	8082                	ret

00000000000008dc <vprintf>:
}

// Print to the given fd. Only understands %d, %x, %p, %s.
void
vprintf(int fd, const char *fmt, va_list ap)
{
 8dc:	7119                	addi	sp,sp,-128
 8de:	fc86                	sd	ra,120(sp)
 8e0:	f8a2                	sd	s0,112(sp)
 8e2:	f4a6                	sd	s1,104(sp)
 8e4:	f0ca                	sd	s2,96(sp)
 8e6:	ecce                	sd	s3,88(sp)
 8e8:	e8d2                	sd	s4,80(sp)
 8ea:	e4d6                	sd	s5,72(sp)
 8ec:	e0da                	sd	s6,64(sp)
 8ee:	fc5e                	sd	s7,56(sp)
 8f0:	f862                	sd	s8,48(sp)
 8f2:	f466                	sd	s9,40(sp)
 8f4:	f06a                	sd	s10,32(sp)
 8f6:	ec6e                	sd	s11,24(sp)
 8f8:	0100                	addi	s0,sp,128
  char *s;
  int c, i, state;

  state = 0;
  for(i = 0; fmt[i]; i++){
 8fa:	0005c483          	lbu	s1,0(a1)
 8fe:	18048d63          	beqz	s1,a98 <vprintf+0x1bc>
 902:	8aaa                	mv	s5,a0
 904:	8b32                	mv	s6,a2
 906:	00158913          	addi	s2,a1,1
  state = 0;
 90a:	4981                	li	s3,0
      if(c == '%'){
        state = '%';
      } else {
        putc(fd, c);
      }
    } else if(state == '%'){
 90c:	02500a13          	li	s4,37
      if(c == 'd'){
 910:	06400c13          	li	s8,100
        printint(fd, va_arg(ap, int), 10, 1);
      } else if(c == 'l') {
 914:	06c00c93          	li	s9,108
        printint(fd, va_arg(ap, uint64), 10, 0);
      } else if(c == 'x') {
 918:	07800d13          	li	s10,120
        printint(fd, va_arg(ap, int), 16, 0);
      } else if(c == 'p') {
 91c:	07000d93          	li	s11,112
    putc(fd, digits[x >> (sizeof(uint64) * 8 - 4)]);
 920:	00000b97          	auipc	s7,0x0
 924:	480b8b93          	addi	s7,s7,1152 # da0 <digits>
 928:	a839                	j	946 <vprintf+0x6a>
        putc(fd, c);
 92a:	85a6                	mv	a1,s1
 92c:	8556                	mv	a0,s5
 92e:	00000097          	auipc	ra,0x0
 932:	ede080e7          	jalr	-290(ra) # 80c <putc>
 936:	a019                	j	93c <vprintf+0x60>
    } else if(state == '%'){
 938:	01498f63          	beq	s3,s4,956 <vprintf+0x7a>
  for(i = 0; fmt[i]; i++){
 93c:	0905                	addi	s2,s2,1
 93e:	fff94483          	lbu	s1,-1(s2)
 942:	14048b63          	beqz	s1,a98 <vprintf+0x1bc>
    c = fmt[i] & 0xff;
 946:	0004879b          	sext.w	a5,s1
    if(state == 0){
 94a:	fe0997e3          	bnez	s3,938 <vprintf+0x5c>
      if(c == '%'){
 94e:	fd479ee3          	bne	a5,s4,92a <vprintf+0x4e>
        state = '%';
 952:	89be                	mv	s3,a5
 954:	b7e5                	j	93c <vprintf+0x60>
      if(c == 'd'){
 956:	05878063          	beq	a5,s8,996 <vprintf+0xba>
      } else if(c == 'l') {
 95a:	05978c63          	beq	a5,s9,9b2 <vprintf+0xd6>
      } else if(c == 'x') {
 95e:	07a78863          	beq	a5,s10,9ce <vprintf+0xf2>
      } else if(c == 'p') {
 962:	09b78463          	beq	a5,s11,9ea <vprintf+0x10e>
        printptr(fd, va_arg(ap, uint64));
      } else if(c == 's'){
 966:	07300713          	li	a4,115
 96a:	0ce78563          	beq	a5,a4,a34 <vprintf+0x158>
          s = "(null)";
        while(*s != 0){
          putc(fd, *s);
          s++;
        }
      } else if(c == 'c'){
 96e:	06300713          	li	a4,99
 972:	0ee78c63          	beq	a5,a4,a6a <vprintf+0x18e>
        putc(fd, va_arg(ap, uint));
      } else if(c == '%'){
 976:	11478663          	beq	a5,s4,a82 <vprintf+0x1a6>
        putc(fd, c);
      } else {
        // Unknown % sequence.  Print it to draw attention.
        putc(fd, '%');
 97a:	85d2                	mv	a1,s4
 97c:	8556                	mv	a0,s5
 97e:	00000097          	auipc	ra,0x0
 982:	e8e080e7          	jalr	-370(ra) # 80c <putc>
        putc(fd, c);
 986:	85a6                	mv	a1,s1
 988:	8556                	mv	a0,s5
 98a:	00000097          	auipc	ra,0x0
 98e:	e82080e7          	jalr	-382(ra) # 80c <putc>
      }
      state = 0;
 992:	4981                	li	s3,0
 994:	b765                	j	93c <vprintf+0x60>
        printint(fd, va_arg(ap, int), 10, 1);
 996:	008b0493          	addi	s1,s6,8
 99a:	4685                	li	a3,1
 99c:	4629                	li	a2,10
 99e:	000b2583          	lw	a1,0(s6)
 9a2:	8556                	mv	a0,s5
 9a4:	00000097          	auipc	ra,0x0
 9a8:	e8a080e7          	jalr	-374(ra) # 82e <printint>
 9ac:	8b26                	mv	s6,s1
      state = 0;
 9ae:	4981                	li	s3,0
 9b0:	b771                	j	93c <vprintf+0x60>
        printint(fd, va_arg(ap, uint64), 10, 0);
 9b2:	008b0493          	addi	s1,s6,8
 9b6:	4681                	li	a3,0
 9b8:	4629                	li	a2,10
 9ba:	000b2583          	lw	a1,0(s6)
 9be:	8556                	mv	a0,s5
 9c0:	00000097          	auipc	ra,0x0
 9c4:	e6e080e7          	jalr	-402(ra) # 82e <printint>
 9c8:	8b26                	mv	s6,s1
      state = 0;
 9ca:	4981                	li	s3,0
 9cc:	bf85                	j	93c <vprintf+0x60>
        printint(fd, va_arg(ap, int), 16, 0);
 9ce:	008b0493          	addi	s1,s6,8
 9d2:	4681                	li	a3,0
 9d4:	4641                	li	a2,16
 9d6:	000b2583          	lw	a1,0(s6)
 9da:	8556                	mv	a0,s5
 9dc:	00000097          	auipc	ra,0x0
 9e0:	e52080e7          	jalr	-430(ra) # 82e <printint>
 9e4:	8b26                	mv	s6,s1
      state = 0;
 9e6:	4981                	li	s3,0
 9e8:	bf91                	j	93c <vprintf+0x60>
        printptr(fd, va_arg(ap, uint64));
 9ea:	008b0793          	addi	a5,s6,8
 9ee:	f8f43423          	sd	a5,-120(s0)
 9f2:	000b3983          	ld	s3,0(s6)
  putc(fd, '0');
 9f6:	03000593          	li	a1,48
 9fa:	8556                	mv	a0,s5
 9fc:	00000097          	auipc	ra,0x0
 a00:	e10080e7          	jalr	-496(ra) # 80c <putc>
  putc(fd, 'x');
 a04:	85ea                	mv	a1,s10
 a06:	8556                	mv	a0,s5
 a08:	00000097          	auipc	ra,0x0
 a0c:	e04080e7          	jalr	-508(ra) # 80c <putc>
 a10:	44c1                	li	s1,16
    putc(fd, digits[x >> (sizeof(uint64) * 8 - 4)]);
 a12:	03c9d793          	srli	a5,s3,0x3c
 a16:	97de                	add	a5,a5,s7
 a18:	0007c583          	lbu	a1,0(a5)
 a1c:	8556                	mv	a0,s5
 a1e:	00000097          	auipc	ra,0x0
 a22:	dee080e7          	jalr	-530(ra) # 80c <putc>
  for (i = 0; i < (sizeof(uint64) * 2); i++, x <<= 4)
 a26:	0992                	slli	s3,s3,0x4
 a28:	34fd                	addiw	s1,s1,-1
 a2a:	f4e5                	bnez	s1,a12 <vprintf+0x136>
        printptr(fd, va_arg(ap, uint64));
 a2c:	f8843b03          	ld	s6,-120(s0)
      state = 0;
 a30:	4981                	li	s3,0
 a32:	b729                	j	93c <vprintf+0x60>
        s = va_arg(ap, char*);
 a34:	008b0993          	addi	s3,s6,8
 a38:	000b3483          	ld	s1,0(s6)
        if(s == 0)
 a3c:	c085                	beqz	s1,a5c <vprintf+0x180>
        while(*s != 0){
 a3e:	0004c583          	lbu	a1,0(s1)
 a42:	c9a1                	beqz	a1,a92 <vprintf+0x1b6>
          putc(fd, *s);
 a44:	8556                	mv	a0,s5
 a46:	00000097          	auipc	ra,0x0
 a4a:	dc6080e7          	jalr	-570(ra) # 80c <putc>
          s++;
 a4e:	0485                	addi	s1,s1,1
        while(*s != 0){
 a50:	0004c583          	lbu	a1,0(s1)
 a54:	f9e5                	bnez	a1,a44 <vprintf+0x168>
        s = va_arg(ap, char*);
 a56:	8b4e                	mv	s6,s3
      state = 0;
 a58:	4981                	li	s3,0
 a5a:	b5cd                	j	93c <vprintf+0x60>
          s = "(null)";
 a5c:	00000497          	auipc	s1,0x0
 a60:	35c48493          	addi	s1,s1,860 # db8 <digits+0x18>
        while(*s != 0){
 a64:	02800593          	li	a1,40
 a68:	bff1                	j	a44 <vprintf+0x168>
        putc(fd, va_arg(ap, uint));
 a6a:	008b0493          	addi	s1,s6,8
 a6e:	000b4583          	lbu	a1,0(s6)
 a72:	8556                	mv	a0,s5
 a74:	00000097          	auipc	ra,0x0
 a78:	d98080e7          	jalr	-616(ra) # 80c <putc>
 a7c:	8b26                	mv	s6,s1
      state = 0;
 a7e:	4981                	li	s3,0
 a80:	bd75                	j	93c <vprintf+0x60>
        putc(fd, c);
 a82:	85d2                	mv	a1,s4
 a84:	8556                	mv	a0,s5
 a86:	00000097          	auipc	ra,0x0
 a8a:	d86080e7          	jalr	-634(ra) # 80c <putc>
      state = 0;
 a8e:	4981                	li	s3,0
 a90:	b575                	j	93c <vprintf+0x60>
        s = va_arg(ap, char*);
 a92:	8b4e                	mv	s6,s3
      state = 0;
 a94:	4981                	li	s3,0
 a96:	b55d                	j	93c <vprintf+0x60>
    }
  }
}
 a98:	70e6                	ld	ra,120(sp)
 a9a:	7446                	ld	s0,112(sp)
 a9c:	74a6                	ld	s1,104(sp)
 a9e:	7906                	ld	s2,96(sp)
 aa0:	69e6                	ld	s3,88(sp)
 aa2:	6a46                	ld	s4,80(sp)
 aa4:	6aa6                	ld	s5,72(sp)
 aa6:	6b06                	ld	s6,64(sp)
 aa8:	7be2                	ld	s7,56(sp)
 aaa:	7c42                	ld	s8,48(sp)
 aac:	7ca2                	ld	s9,40(sp)
 aae:	7d02                	ld	s10,32(sp)
 ab0:	6de2                	ld	s11,24(sp)
 ab2:	6109                	addi	sp,sp,128
 ab4:	8082                	ret

0000000000000ab6 <fprintf>:

void
fprintf(int fd, const char *fmt, ...)
{
 ab6:	715d                	addi	sp,sp,-80
 ab8:	ec06                	sd	ra,24(sp)
 aba:	e822                	sd	s0,16(sp)
 abc:	1000                	addi	s0,sp,32
 abe:	e010                	sd	a2,0(s0)
 ac0:	e414                	sd	a3,8(s0)
 ac2:	e818                	sd	a4,16(s0)
 ac4:	ec1c                	sd	a5,24(s0)
 ac6:	03043023          	sd	a6,32(s0)
 aca:	03143423          	sd	a7,40(s0)
  va_list ap;

  va_start(ap, fmt);
 ace:	fe843423          	sd	s0,-24(s0)
  vprintf(fd, fmt, ap);
 ad2:	8622                	mv	a2,s0
 ad4:	00000097          	auipc	ra,0x0
 ad8:	e08080e7          	jalr	-504(ra) # 8dc <vprintf>
}
 adc:	60e2                	ld	ra,24(sp)
 ade:	6442                	ld	s0,16(sp)
 ae0:	6161                	addi	sp,sp,80
 ae2:	8082                	ret

0000000000000ae4 <printf>:

void
printf(const char *fmt, ...)
{
 ae4:	711d                	addi	sp,sp,-96
 ae6:	ec06                	sd	ra,24(sp)
 ae8:	e822                	sd	s0,16(sp)
 aea:	1000                	addi	s0,sp,32
 aec:	e40c                	sd	a1,8(s0)
 aee:	e810                	sd	a2,16(s0)
 af0:	ec14                	sd	a3,24(s0)
 af2:	f018                	sd	a4,32(s0)
 af4:	f41c                	sd	a5,40(s0)
 af6:	03043823          	sd	a6,48(s0)
 afa:	03143c23          	sd	a7,56(s0)
  va_list ap;

  va_start(ap, fmt);
 afe:	00840613          	addi	a2,s0,8
 b02:	fec43423          	sd	a2,-24(s0)
  vprintf(1, fmt, ap);
 b06:	85aa                	mv	a1,a0
 b08:	4505                	li	a0,1
 b0a:	00000097          	auipc	ra,0x0
 b0e:	dd2080e7          	jalr	-558(ra) # 8dc <vprintf>
}
 b12:	60e2                	ld	ra,24(sp)
 b14:	6442                	ld	s0,16(sp)
 b16:	6125                	addi	sp,sp,96
 b18:	8082                	ret

0000000000000b1a <free>:
static Header base;
static Header *freep;

void
free(void *ap)
{
 b1a:	1141                	addi	sp,sp,-16
 b1c:	e422                	sd	s0,8(sp)
 b1e:	0800                	addi	s0,sp,16
  Header *bp, *p;

  bp = (Header*)ap - 1;
 b20:	ff050693          	addi	a3,a0,-16
  for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
 b24:	00000797          	auipc	a5,0x0
 b28:	29c78793          	addi	a5,a5,668 # dc0 <__bss_start>
 b2c:	639c                	ld	a5,0(a5)
 b2e:	a805                	j	b5e <free+0x44>
    if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
      break;
  if(bp + bp->s.size == p->s.ptr){
    bp->s.size += p->s.ptr->s.size;
 b30:	4618                	lw	a4,8(a2)
 b32:	9db9                	addw	a1,a1,a4
 b34:	feb52c23          	sw	a1,-8(a0)
    bp->s.ptr = p->s.ptr->s.ptr;
 b38:	6398                	ld	a4,0(a5)
 b3a:	6318                	ld	a4,0(a4)
 b3c:	fee53823          	sd	a4,-16(a0)
 b40:	a091                	j	b84 <free+0x6a>
  } else
    bp->s.ptr = p->s.ptr;
  if(p + p->s.size == bp){
    p->s.size += bp->s.size;
 b42:	ff852703          	lw	a4,-8(a0)
 b46:	9e39                	addw	a2,a2,a4
 b48:	c790                	sw	a2,8(a5)
    p->s.ptr = bp->s.ptr;
 b4a:	ff053703          	ld	a4,-16(a0)
 b4e:	e398                	sd	a4,0(a5)
 b50:	a099                	j	b96 <free+0x7c>
    if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
 b52:	6398                	ld	a4,0(a5)
 b54:	00e7e463          	bltu	a5,a4,b5c <free+0x42>
 b58:	00e6ea63          	bltu	a3,a4,b6c <free+0x52>
{
 b5c:	87ba                	mv	a5,a4
  for(p = freep; !(bp > p && bp < p->s.ptr); p = p->s.ptr)
 b5e:	fed7fae3          	bleu	a3,a5,b52 <free+0x38>
 b62:	6398                	ld	a4,0(a5)
 b64:	00e6e463          	bltu	a3,a4,b6c <free+0x52>
    if(p >= p->s.ptr && (bp > p || bp < p->s.ptr))
 b68:	fee7eae3          	bltu	a5,a4,b5c <free+0x42>
  if(bp + bp->s.size == p->s.ptr){
 b6c:	ff852583          	lw	a1,-8(a0)
 b70:	6390                	ld	a2,0(a5)
 b72:	02059713          	slli	a4,a1,0x20
 b76:	9301                	srli	a4,a4,0x20
 b78:	0712                	slli	a4,a4,0x4
 b7a:	9736                	add	a4,a4,a3
 b7c:	fae60ae3          	beq	a2,a4,b30 <free+0x16>
    bp->s.ptr = p->s.ptr;
 b80:	fec53823          	sd	a2,-16(a0)
  if(p + p->s.size == bp){
 b84:	4790                	lw	a2,8(a5)
 b86:	02061713          	slli	a4,a2,0x20
 b8a:	9301                	srli	a4,a4,0x20
 b8c:	0712                	slli	a4,a4,0x4
 b8e:	973e                	add	a4,a4,a5
 b90:	fae689e3          	beq	a3,a4,b42 <free+0x28>
  } else
    p->s.ptr = bp;
 b94:	e394                	sd	a3,0(a5)
  freep = p;
 b96:	00000717          	auipc	a4,0x0
 b9a:	22f73523          	sd	a5,554(a4) # dc0 <__bss_start>
}
 b9e:	6422                	ld	s0,8(sp)
 ba0:	0141                	addi	sp,sp,16
 ba2:	8082                	ret

0000000000000ba4 <malloc>:
  return freep;
}

void*
malloc(uint nbytes)
{
 ba4:	7139                	addi	sp,sp,-64
 ba6:	fc06                	sd	ra,56(sp)
 ba8:	f822                	sd	s0,48(sp)
 baa:	f426                	sd	s1,40(sp)
 bac:	f04a                	sd	s2,32(sp)
 bae:	ec4e                	sd	s3,24(sp)
 bb0:	e852                	sd	s4,16(sp)
 bb2:	e456                	sd	s5,8(sp)
 bb4:	e05a                	sd	s6,0(sp)
 bb6:	0080                	addi	s0,sp,64
  Header *p, *prevp;
  uint nunits;

  nunits = (nbytes + sizeof(Header) - 1)/sizeof(Header) + 1;
 bb8:	02051993          	slli	s3,a0,0x20
 bbc:	0209d993          	srli	s3,s3,0x20
 bc0:	09bd                	addi	s3,s3,15
 bc2:	0049d993          	srli	s3,s3,0x4
 bc6:	2985                	addiw	s3,s3,1
 bc8:	0009891b          	sext.w	s2,s3
  if((prevp = freep) == 0){
 bcc:	00000797          	auipc	a5,0x0
 bd0:	1f478793          	addi	a5,a5,500 # dc0 <__bss_start>
 bd4:	6388                	ld	a0,0(a5)
 bd6:	c515                	beqz	a0,c02 <malloc+0x5e>
    base.s.ptr = freep = prevp = &base;
    base.s.size = 0;
  }
  for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
 bd8:	611c                	ld	a5,0(a0)
    if(p->s.size >= nunits){
 bda:	4798                	lw	a4,8(a5)
 bdc:	03277f63          	bleu	s2,a4,c1a <malloc+0x76>
 be0:	8a4e                	mv	s4,s3
 be2:	0009871b          	sext.w	a4,s3
 be6:	6685                	lui	a3,0x1
 be8:	00d77363          	bleu	a3,a4,bee <malloc+0x4a>
 bec:	6a05                	lui	s4,0x1
 bee:	000a0a9b          	sext.w	s5,s4
  p = sbrk(nu * sizeof(Header));
 bf2:	004a1a1b          	slliw	s4,s4,0x4
        p->s.size = nunits;
      }
      freep = prevp;
      return (void*)(p + 1);
    }
    if(p == freep)
 bf6:	00000497          	auipc	s1,0x0
 bfa:	1ca48493          	addi	s1,s1,458 # dc0 <__bss_start>
  if(p == (char*)-1)
 bfe:	5b7d                	li	s6,-1
 c00:	a885                	j	c70 <malloc+0xcc>
    base.s.ptr = freep = prevp = &base;
 c02:	00000797          	auipc	a5,0x0
 c06:	1c678793          	addi	a5,a5,454 # dc8 <base>
 c0a:	00000717          	auipc	a4,0x0
 c0e:	1af73b23          	sd	a5,438(a4) # dc0 <__bss_start>
 c12:	e39c                	sd	a5,0(a5)
    base.s.size = 0;
 c14:	0007a423          	sw	zero,8(a5)
    if(p->s.size >= nunits){
 c18:	b7e1                	j	be0 <malloc+0x3c>
      if(p->s.size == nunits)
 c1a:	02e90b63          	beq	s2,a4,c50 <malloc+0xac>
        p->s.size -= nunits;
 c1e:	4137073b          	subw	a4,a4,s3
 c22:	c798                	sw	a4,8(a5)
        p += p->s.size;
 c24:	1702                	slli	a4,a4,0x20
 c26:	9301                	srli	a4,a4,0x20
 c28:	0712                	slli	a4,a4,0x4
 c2a:	97ba                	add	a5,a5,a4
        p->s.size = nunits;
 c2c:	0137a423          	sw	s3,8(a5)
      freep = prevp;
 c30:	00000717          	auipc	a4,0x0
 c34:	18a73823          	sd	a0,400(a4) # dc0 <__bss_start>
      return (void*)(p + 1);
 c38:	01078513          	addi	a0,a5,16
      if((p = morecore(nunits)) == 0)
        return 0;
  }
}
 c3c:	70e2                	ld	ra,56(sp)
 c3e:	7442                	ld	s0,48(sp)
 c40:	74a2                	ld	s1,40(sp)
 c42:	7902                	ld	s2,32(sp)
 c44:	69e2                	ld	s3,24(sp)
 c46:	6a42                	ld	s4,16(sp)
 c48:	6aa2                	ld	s5,8(sp)
 c4a:	6b02                	ld	s6,0(sp)
 c4c:	6121                	addi	sp,sp,64
 c4e:	8082                	ret
        prevp->s.ptr = p->s.ptr;
 c50:	6398                	ld	a4,0(a5)
 c52:	e118                	sd	a4,0(a0)
 c54:	bff1                	j	c30 <malloc+0x8c>
  hp->s.size = nu;
 c56:	01552423          	sw	s5,8(a0)
  free((void*)(hp + 1));
 c5a:	0541                	addi	a0,a0,16
 c5c:	00000097          	auipc	ra,0x0
 c60:	ebe080e7          	jalr	-322(ra) # b1a <free>
  return freep;
 c64:	6088                	ld	a0,0(s1)
      if((p = morecore(nunits)) == 0)
 c66:	d979                	beqz	a0,c3c <malloc+0x98>
  for(p = prevp->s.ptr; ; prevp = p, p = p->s.ptr){
 c68:	611c                	ld	a5,0(a0)
    if(p->s.size >= nunits){
 c6a:	4798                	lw	a4,8(a5)
 c6c:	fb2777e3          	bleu	s2,a4,c1a <malloc+0x76>
    if(p == freep)
 c70:	6098                	ld	a4,0(s1)
 c72:	853e                	mv	a0,a5
 c74:	fef71ae3          	bne	a4,a5,c68 <malloc+0xc4>
  p = sbrk(nu * sizeof(Header));
 c78:	8552                	mv	a0,s4
 c7a:	00000097          	auipc	ra,0x0
 c7e:	b72080e7          	jalr	-1166(ra) # 7ec <sbrk>
  if(p == (char*)-1)
 c82:	fd651ae3          	bne	a0,s6,c56 <malloc+0xb2>
        return 0;
 c86:	4501                	li	a0,0
 c88:	bf55                	j	c3c <malloc+0x98>
